#!/usr/bin/python2.5
# -*- coding: utf-8 -*-
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tipfy.ext.i18n import lazy_gettext as _

STATUS_TEXT_MAP = {
    'information_sought': _(u'情報を求めている人がいます'),
    'is_note_author': _(u'本人情報があります'),
    'believed_alive': _(u'生存情報があります'),
    'believed_missing': _(u'行方不明情報があります'),
    'believed_dead': _(u'訃報が寄せられています')
    }

STATUS_SIMPLE_MAP = {
    'information_sought': _(u'情報求む'),
    'is_note_author': _(u'本人情報'),
    'believed_alive': _(u'生存情報'),
    'believed_missing': _(u'行方不明情報'),
    'believed_dead': _(u'訃報')
    }

def mapStatusText(s):
  return STATUS_TEXT_MAP.get(s, s)


def mapStatusSimple(s):
  return STATUS_SIMPLE_MAP.get(s, s)


def joinHomeAddress(person):
  home_values = []
  for v in [person.get('home_street'),
            person.get('home_neighborhood'),
            person.get('home_city'),
            person.get('home_state'),
            person.get('home_postal_code')]:
    if v:
      home_values.append(v)
  return ' '.join(home_values)
